<template>
	<el-form ref="form" :model="goods" label-width="80px" @submit.prevent="onSubmit" style="margin:20px;width:60%;min-width:600px;">
		<el-form-item label="">
			<el-select v-if="shops!=''" v-model="goods.shopId" placeholder="请选择店铺">
			  <el-option v-for="(item,i) in shops" :key="i" :label="item.shopName" :value="item.shopId">
				  {{item.shopName}}
			  </el-option>
			</el-select>
		  </el-form-item>
		  <el-form-item label="商品名">
			<el-input v-model="goods.goodsName"></el-input>
		</el-form-item>
		<el-form-item label="商品价格">
			<el-input type="number" v-model="goods.goodsPrice"></el-input>
		</el-form-item>
		<el-form-item label="商品特色">
			<el-input v-model="goods.shopNotice"></el-input>
		</el-form-item>
		 <!-- <el-upload
		 class="upload-demo"
		 ref="upload"
		 action="https://sm.ms/api/upload"
		 :on-preview="handlePreview"
		 :file-list="fileList"
		 :on-success="handleUpSuc"
		 :auto-upload="false">
		 <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
		 <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload">上传到服务器</el-button>
		 <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
	   </el-upload> -->
		<el-form-item>
			<el-button @click.stop="regGoods" type="primary">提交</el-button>
			<el-button @click.native.prevent>取消</el-button>
		</el-form-item>
	</el-form>
	
</template>

<script>
	export default {
		created(){
			this.getShops()
		},
		data() {
			return {
				fileList: [],
				imageUrl: '',
				goods: {
					shopId:'',
					goodsCharacteristics:'',
					goodsName: '',
					goodsPrice:'',
					goodsCharacteristics:'',
					merchantId:this.$store.state.user.merchantId,

				},
				shops:''
			}
		},
		methods: {
			handleUpSuc(res){
			},
			submitUpload() {
				this.$refs.upload.submit();
			},
			handlePreview(file) {
			},
			getShops(){
				this.$axios({
					method:'get',
					params:{
						merchantId:this.$store.state.user.merchantId
					},
					url:'/getShop'
				}).then(r=>{
					this.shops = r.data.result
				}).catch(err=>{
					this.$error()
				})
			},
			regGoods(){
				
			},
			onSubmit() {
			}
		}
	}

</script>

<style scoped>
	.avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>